package com.yuan.vo;

import lombok.Data;

import java.io.Serializable;

@Data
public class ResponseVO implements Serializable {
    private static final long serialVersionUID = -1005863670741860901L;
    // 响应码
    private Integer code;

    // 描述信息
    private String message;

    private ResponseVO(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * 返回成功信息
     * @return
     */
    public static ResponseVO success(String message) {
        return new ResponseVO(200, message);
    }

    /**
     * 返回成功信息
     * @return
     */
    public static ResponseVO success() {
        return new ResponseVO(200,"success");
    }

    /**
     * 返回错误信息
     * @return
     */
    public static ResponseVO error(String message) {
        return new ResponseVO(500,message);
    }
}
